package com.bestcem.xm.wallet.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.stream.Stream;

/**
 * 发票类型枚举
 *
 * @author qiongyu.cui <qiongyu.cui@idiaoyan.com>
 * @version v1.0
 * @date 2022/3/19 14:57
 */
@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum InvoiceTypeEnum {

    /**
     * 发票类型枚举
     */
    ELECTRONIC(1, "电子普通发票"),
    GENERAL_VAT(2, "增值税普通发票"),
    SPECIAL_VAT(3, "增值税专用发票");

    private Integer type;
    private String detail;

    /**
     * 根据发票类型获取发票枚举内容
     *
     * @param type 发票类型
     * @return com.bestcem.xm.wallet.enums.InvoiceTypeEnum
     * @author cuiqiongyu <qiongyu.cui@idiaoyan.cn>
     * @date 2022/03/19 15:03
     */
    public static InvoiceTypeEnum getByType(Integer type) {
        return Stream.of(values()).filter(t -> t.getType().equals(type)).findFirst().orElse(null);
    }

}
